class LoginsController < ApplicationController
	skip_before_filter :require_login
	
	def new
		@login = Login.new(params[:login])
		
		respond_to do |format|
			format.html
			format.xml  { render :xml => @login }
		end
	end
	
	def create
		if user = User.authenticate(params[:login][:login], params[:login][:password]) 
			session[:current_user_id] = user.id
			puts user.id
			redirect_to root_url 
		else
			flash[:notice] = 'Failed to connect.'
			redirect_to login_url
		end
	end
	
	def destroy
		session[:current_user_id] = nil
	end
end
